package pers.fish.sso.common.util;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

/**
 * cookie工具类
 *
 * @author HUAWEI
 * @date 2020/8/19
 */
public class CookieUtil {

    public static String getCookieValue(HttpServletRequest request,String cookieName){
        Cookie[] cookies = request.getCookies();
        String result = null;
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                if (!cookieName.equals(cookie.getName())) {
                    continue;
                }
                result = cookie.getValue();
            }
        }
        return result;
    }
}
